package com.kornero.auto.util.view;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Layout;

public class LayoutManager {

    public static Layout getFillVerticalLayout() {
        final FillLayout fillLayout = new FillLayout();
        fillLayout.type = SWT.VERTICAL;
        fillLayout.marginWidth = 5;
        fillLayout.marginHeight = 5;
        return fillLayout;
    }

    public static Layout getRowVerticalLayout() {
        final RowLayout rowLayout = new RowLayout();
        rowLayout.type = SWT.VERTICAL;
        rowLayout.marginWidth = 5;
        rowLayout.marginHeight = 5;
        return rowLayout;
    }

    public static Layout getGridLayout() {
        return new GridLayout();
    }

    public static Layout getGridOneColumnLayout() {
        return getGridColumnsLayout(1);
    }

    public static Layout getGridColumnsLayout(final int columns) {
        final GridLayout layout = new GridLayout();
        layout.numColumns = columns;
        return layout;
    }

    public static GridData getLayoutDataFillHorizontal() {
        return new GridData(GridData.FILL_HORIZONTAL);
    }

    public static GridData getLayoutDataFillVertical() {
        return new GridData(GridData.FILL_VERTICAL);
    }

    public static GridData getLayoutDataFillAll() {
        return new GridData(GridData.FILL_BOTH);
    }
}
